<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiRequest;
use Illuminate\Validation\Rule;

/**
 * @property string password
 * @property string expired
 * @property string type
 * @property string token
 */
class ResetPasswordRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'type'        => ['required', 'string', Rule::in(['panx', 'customer', 'store'])],
            'password'    => 'required|string|min:6|confirmed|max:'.self::MAX_STRING,
            'expired'     => 'required|string|max:'.self::MAX_STRING,
            'token'       => 'required|string|min:1',
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'type.*'             => '账号的类型必须是panx，customer 或 store',
//            'token.*'            => '登录名称必须是字符串',
//            'password.confirmed' => '两次密码输入不一致',
//            'password.*'         => '密码填写错误',
//            'expired.*'          => '有限期必须填写'
//        ];
//    }
}
